/**
 * <copyright>
 * </copyright>
 *

 */
package br.ufpe.cin.plp.eseml.impl;

import br.ufpe.cin.plp.eseml.EsemlPackage;
import br.ufpe.cin.plp.eseml.Hypothesis;
import br.ufpe.cin.plp.eseml.NullHypothesis;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Null Hypothesis</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link br.ufpe.cin.plp.eseml.impl.NullHypothesisImpl#getHypothesis <em>Hypothesis</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class NullHypothesisImpl extends MinimalEObjectImpl.Container implements NullHypothesis
{
  /**
   * The cached value of the '{@link #getHypothesis() <em>Hypothesis</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getHypothesis()
   * @generated
   * @ordered
   */
  protected Hypothesis hypothesis;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected NullHypothesisImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return EsemlPackage.Literals.NULL_HYPOTHESIS;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Hypothesis getHypothesis()
  {
    return hypothesis;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetHypothesis(Hypothesis newHypothesis, NotificationChain msgs)
  {
    Hypothesis oldHypothesis = hypothesis;
    hypothesis = newHypothesis;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EsemlPackage.NULL_HYPOTHESIS__HYPOTHESIS, oldHypothesis, newHypothesis);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setHypothesis(Hypothesis newHypothesis)
  {
    if (newHypothesis != hypothesis)
    {
      NotificationChain msgs = null;
      if (hypothesis != null)
        msgs = ((InternalEObject)hypothesis).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EsemlPackage.NULL_HYPOTHESIS__HYPOTHESIS, null, msgs);
      if (newHypothesis != null)
        msgs = ((InternalEObject)newHypothesis).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EsemlPackage.NULL_HYPOTHESIS__HYPOTHESIS, null, msgs);
      msgs = basicSetHypothesis(newHypothesis, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, EsemlPackage.NULL_HYPOTHESIS__HYPOTHESIS, newHypothesis, newHypothesis));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case EsemlPackage.NULL_HYPOTHESIS__HYPOTHESIS:
        return basicSetHypothesis(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case EsemlPackage.NULL_HYPOTHESIS__HYPOTHESIS:
        return getHypothesis();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case EsemlPackage.NULL_HYPOTHESIS__HYPOTHESIS:
        setHypothesis((Hypothesis)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case EsemlPackage.NULL_HYPOTHESIS__HYPOTHESIS:
        setHypothesis((Hypothesis)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case EsemlPackage.NULL_HYPOTHESIS__HYPOTHESIS:
        return hypothesis != null;
    }
    return super.eIsSet(featureID);
  }

} //NullHypothesisImpl
